<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
		<script src="js/vue.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>		
		<div id="app">
			<br/>
			<p>我们测试使用$ref来直接访问子组件，但官方并不推荐使用该方案，仅作为应急方案。</p>
			<vue-index ref="vIndex"></vue-index>
		</div>
	</body>
<script type="text/javascript">
var app = new Vue({
	el: '#app',
	components: {
		'vue-index': {
			data: function(){
				return {
					message: "这是首页"
				};
			},
			template: '<div style="height: 50px; background-color: #00FFFF;">{{message}}</div>',
			created: function(){
				var that = this;
				window.setTimeout(function(){
					that.message = "1.这是首页";
				}, 2000);
			}
		}
	}
});

console.log(app.$refs['vIndex']);
console.log(app.$refs.vIndex.message);
app.$refs.vIndex.message = "123456";  //不推荐，虽然可以起效果
</script>
</html>